/* 
 * File:   widget_curve.h
 * Author: dima
 *
 * Created on 12 Январь 2015 г., 15:24
 */

#ifndef WIDGET_CURVE_H
#define	WIDGET_CURVE_H
#include <QVector>
#include <qwt_plot.h>
class QwtPlotGrid;
class QwtPlotCurve;

class widget_curve : public QwtPlot {
    Q_OBJECT
public:
    widget_curve(QWidget *widget = NULL);
    widget_curve(const QwtText &title, QWidget *widget = NULL);
    virtual ~widget_curve();
    inline void set_title_coordinates(QString title_x, QString title_y); //Specify the name of the coordinate axes
    inline void set_size_XY(double min_x, double max_x, double step_x, double min_y, double max_y, double step_y); //Specify the dimension of the coordinate axes
    inline void set_size_X(double min_x, double max_x, double step_x); // Set the dimension of X
    inline void set_size_Y(double min_y, double max_y, double step_y); // Set the dimension of Y
    void set_title(QString set_title); // set title for curve
    void set_data(); //Set the data for the curve
    void add_value(double x, double y); //Add interval for the curve
protected:
    QVector<double> *X; //X coordinate
    QVector<double> *Y; //X coordinate
private:
    widget_curve(const widget_curve&);
    void init_window(); // initialization window
    QwtPlotCurve *curve; //curve
    QwtPlotGrid *grid; //grid
};

void widget_curve::set_title_coordinates(QString title_x, QString title_y)//Specify the name of the coordinate axes
{
    setAxisTitle(QwtPlot::yLeft, title_x);
    setAxisTitle(QwtPlot::xBottom, title_y);
}

void widget_curve::set_size_XY(double min_x, double max_x, double step_x, double min_y, double max_y, double step_y)//Specify the dimension of the coordinate axes
{
    set_size_X(min_x, max_x, step_x);
    set_size_Y(min_y, max_y, step_y);
}

void widget_curve::set_size_X(double min_x, double max_x, double step_x)//Set the dimension of X
{
    setAxisScale(QwtPlot::yLeft, min_x, max_x, step_x);
}

void widget_curve::set_size_Y(double min_y, double max_y, double step_y)//Set the dimension of Y
{
    setAxisScale(QwtPlot::xBottom, min_y, max_y, step_y);
}

#endif	/* WIDGET_CURVE_H */

